package System;

import java.util.Random;

/**
 * Classe geradora de IDs.
 * 
 * @author Antonio Ricardo
 */

public class IdGenerator {


	final static int ID_SIZE = 10;

	
	/**
	 * Construtor gerador de ID.
	 * 
	 * @return newID
	 * @throws Exception
	 */
	public String generateId()throws Exception {
		String newId = "";
		int number;
		Random random = new Random();
		for (int i = 0; i < ID_SIZE; i++) {
			number = random.nextInt(ID_SIZE - 1);
			newId += number;
		}

		if(newId.length() != ID_SIZE){
			throw new Exception("ID com tamanho incorreto");
		}
				
		return newId;
	}

}
